
#include <gfx/ieffect.h>
#include <gfx/material.h>
#include <gfx/texturepack.h>

ceMaterial::ceMaterial()
	: CE_ASSET_SUPER()
	, _effect (0)
{
  CE_OBJECT_CONSTR;

  _materialSpec.Ambient = ceColor4f(0.0f, 0.0f, 0.0f, 1.0f);
  _materialSpec.Diffuse = ceColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  _materialSpec.Specular = ceColor4f(1.0f, 1.0f, 1.0f, 1.0f);
  _materialSpec.Shininess = 32.0f;
  _materialSpec.Emission = ceColor4f(0.0f, 0.0f, 0.0f, 1.0f);
  _materialSpec.Transparency = false;
  _materialSpec.WriteDepth = true;
  _materialSpec.TestDepth = true;
  _materialSpec.Unlit = false;
}

ceMaterial::~ceMaterial()
{
}



void ceMaterial::SetEffect(iEffect *effect)
{
  CE_SET (_effect, effect);
}

iEffect* ceMaterial::GetEffect()
{
  return _effect;
}


const iEffect* ceMaterial::GetEffect() const
{
  return _effect;
}

const ceTexturePack* ceMaterial::GetTextures() const
{
  return &_textures;
}

ceTexturePack* ceMaterial::GetTextures()
{
  return &_textures;
}

const ceMaterialSpec& ceMaterial::GetMaterialSpec() const
{
  return _materialSpec;
}

ceMaterialSpec& ceMaterial::GetMaterialSpec()
{
  return _materialSpec;
}

const ceSharedShaderBinding& ceMaterial::GetSharedShaderBinding () const
{
	return _sharedBindings;
}

ceSharedShaderBinding& ceMaterial::GetSharedShaderBinding ()
{
	return _sharedBindings;
}


void ceMaterial::SetTexture (ceRenderPass rp, ceTextureStage stage, iTexture* texture)
{
  _textures.SetTexture (rp, stage, texture);
}
